import os

import pytest

from storage import hash_algorithms


@pytest.fixture
def data():
    return os.urandom(8192)


@pytest.mark.benchmark
@pytest.mark.parametrize("hasher", [
    hash_algorithms.md5,
    hash_algorithms.farm64,
    hash_algorithms.murmur2_64,
    hash_algorithms.farm128,
    hash_algorithms.t1ha0_64,
])
def test_benchmark_hash_algorithm(benchmark, hasher, data):
    benchmark(hasher, data)


@pytest.mark.parametrize("hasher", [
    hash_algorithms.md5,
    hash_algorithms.farm64,
    hash_algorithms.murmur2_64,
    hash_algorithms.farm128,
    hash_algorithms.t1ha0_64,
])
def test_smoking_hash_algorithm(hasher, data):
    hasher(data)
